<?php

namespace app\api\controller;

use app\common\controller\Api;
use think\Db;

/**
 * 封装方法
 */
class My
{
    /**
     * 获取手机类型
     */
    public static function getPhonetype($ua)
    {
        $data = [
            'browser_type' => self::getBrotype($ua), //浏览器类型
            'device_brand' => '', //设备品牌
            'device_model' => '', //设备型号
            'os_type' => '' //系统类型 Android/Apple/Windows
        ];
        $device_brand = '';
        $device_model = '';
        $os_type = 'Android';
        $model = '';

        $ver = self::getOsVer($ua);
        $data['net_type'] = self::getNetType($ua);
        $data['os_ver'] = $ver;
        //return $ver;
        if (self::strexists($ua, 'Android')) {
            if (self::strexists($ua, 'zh-cn;')) {
                $model = self::getSubstr($ua, 'zh-cn; ', ' Build');
            } elseif (self::strexists($ua, 'zh-CN;')) {
                $model = self::getSubstr($ua, 'zh-CN; ', ' Build');
            } else {
                //; wv)
                //Mozilla/5.0 (Linux; Android 11; Build/RKQ1.201217.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/4434 MMWEBSDK/20230504 Mobile Safari/537.36 MMWEBID/7285 MicroMessenger/8.0.37.2380(0x28002536) WeChat/arm32 Weixin NetType/4G Language/zh_CN ABI/arm64
                if (self::strexists($ua, $ver . '; ') && self::strexists($ua, 'Build')) {
                    $model = self::getSubstr($ua, $ver . '; ', ' Build');
                } elseif (self::strexists($ua, '; wv)') && self::strexists($ua, $ver . '; ')) {
                    $model = self::getSubstr($ua, $ver . '; ', '; wv');
                } else {
                    // return $model;
                    if (!$model) {
                        $model = self::getSubstr($ua, $ver . '; ', ')');
                    }
                }
            }
            //ozilla/5.0 (Linux; Android 12; M2004J7AC Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/111.0.5563.116 Mobile Safari/537.36 XWEB/5307 MMWEBSDK/20230805 MMWEBID/8738 MicroMessenger/8.0.42.2460(0x28002A54) WeChat/arm64 Weixin NetType/5G Language/zh_CN ABI/arm64
            //  return $model;

            if (strlen($model) < 18) {
                $m = db::table('fa_ua_model')->where('model', $model)->find();
                if ($m) {
                    $data['device_brand'] = $m['phone_type'];
                    $data['device_model'] = $m['phone_model'];
                    $data['os_type'] = $os_type;
                    return $data;
                }
            }
        }

        if (self::strexists($ua, 'Windows')) {
            $os_type = "Windows";
            $device_brand = "Windows";
        } elseif (self::strexists($ua, 'Mac OS X')) {
            if (self::strexists($ua, 'iPhone')) {
                $os_type =  'iPhone';
                $device_brand = "iPhone";
            } elseif (self::strexists($ua, 'iPad')) {
                $os_type =  'iPad';
                $device_brand = "iPad";
            } else {
                $os_type =  'Mac';
                $device_brand = "Mac";
            }
        } elseif (self::strexists($ua, 'Coolpad')) {
            $device_brand = "酷派";
            //vivo NEX A
        } elseif (self::strexists($ua, 'PFEM10')) {
            $device_brand = "OPPO";
            $device_model = "FindX5Pro";
        } elseif (self::strexists($ua, '2112123AC')) {
            $device_brand = "小米";
            $device_model = "12X";
            //荣耀8
        } elseif (self::strexists($ua, 'PRA-AL00X')) {
            $device_brand = "荣耀";
            $device_model = "8";
        } elseif (self::strexists($ua, 'PGZ110')) {
            $device_brand = "一加";
            $device_model = "Ace";
        } elseif (self::strexists($ua, '21061110AG')) {
            $device_brand = "Redmi";
            $device_model = "Note 10 Pro";
        } elseif (self::strexists($ua, 'VNE-AN40')) {
            $device_brand = "荣耀";
            $device_model = "Play6C";
        } elseif (self::strexists($ua, '')) {
            $device_brand = "";
            $device_model = "";
        } elseif (self::strexists($ua, '')) {
            $device_brand = "";
            $device_model = "";
        } elseif (self::strexists($ua, '')) {
            $device_brand = "";
            $device_model = "";
        } elseif (self::strexists($ua, '')) {
            $device_brand = "";
            $device_model = "";
        } elseif (self::strexists($ua, 'MGZ-BD00')) {
            $device_brand = "华为智选";
            $device_model = "Hi nova 10 Pro";
        } elseif (self::strexists($ua, 'JSN-TL00')) {
            $device_brand = "荣耀";
            $device_model = "8X";
        } elseif (self::strexists($ua, 'NAT-TN70')) {
            $device_brand = "荣耀";
            $device_model = "V40";
        } elseif (self::strexists($ua, 'XT2335-3')) {
            $device_brand = "MOTO";
            $device_model = "G53";
        } elseif (self::strexists($ua, 'vivo X9')) {
            $device_brand = "VIVO";
            $device_model = "X9";
        } elseif (self::strexists($ua, 'TNA-TN00')) {
            $device_brand = "荣耀";
            $device_model = "60pro";
        } elseif (self::strexists($ua, 'Note 7')) {
            $device_brand = "Redmi";
            $device_model = "Note 7";
        } elseif (self::strexists($ua, 'RMX3770')) {
            $device_brand = "真我";
            $device_model = "11Pro";
        } elseif (self::strexists($ua, '23090RA98C')) {
            $device_brand = "Redmi";
            $device_model = "Note 13";
        } elseif (self::strexists($ua, 'vivo X6S')) {
            $device_brand = "VIVO";
            $device_model = "X6S";
        } elseif (self::strexists($ua, 'RMX3562')) {
            $device_brand = "真我";
            $device_model = "GTNeo3";
        } elseif (self::strexists($ua, 'KB2005')) {
            $device_brand = "一加";
            $device_model = "8T";
        } elseif (self::strexists($ua, 'Moto G7')) {
            $device_brand = "MOTO";
            $device_model = "G7";
        } elseif (self::strexists($ua, 'RMX3092')) {
            $device_brand = "真我";
            $device_model = "V15";
        } elseif (self::strexists($ua, 'ASK-AL00x')) {
            $device_brand = "荣耀";
            $device_model = "Play3";
        } elseif (self::strexists($ua, 'TB-J606F')) {
            $device_brand = "Lenovo";
            $device_model = "TB-J606F";
        } elseif (self::strexists($ua, 'MOA-AL20')) {
            $device_brand = "荣耀";
            $device_model = "畅玩9A";
        } elseif (self::strexists($ua, 'RMX3043')) {
            $device_brand = "真我";
            $device_model = "V13";
        } elseif (self::strexists($ua, 'Lenovo L71091')) {
            $device_brand = "Lenovo";
            $device_model = "L71091";
        } elseif (self::strexists($ua, 'V1809T')) {
            $device_brand = "VIVO";
            $device_model = "X23";
        } elseif (self::strexists($ua, 'NX666J')) {
            $device_brand = "红魔";
            $device_model = "6R";
        } elseif (self::strexists($ua, '2107119DC')) {
            $device_brand = "小米";
            $device_model = "CC11";
        } elseif (self::strexists($ua, 'PENM00')) {
            $device_brand = "OPPO";
            $device_model = "Reno6Pro";
        } elseif (self::strexists($ua, 'S6 Build')) {
            $device_brand = "VIVO";
            $device_model = "S6";
        } elseif (self::strexists($ua, 'JAT-AL00')) {
            $device_brand = "荣耀";
            $device_model = "畅玩8A";
        } elseif (self::strexists($ua, 'RMX3700')) {
            $device_brand = "真我";
            $device_model = "GTNeo5SE";
        } elseif (self::strexists($ua, 'PACM00')) {
            $device_brand = "OPPO";
            $device_model = "R15";
        } elseif (self::strexists($ua, 'PGIM10')) {
            $device_brand = "OPPO";
            $device_model = "A55s";
        } elseif (self::strexists($ua, 'PCGM00')) {
            $device_brand = "OPPO";
            $device_model = "K3";
        } elseif (self::strexists($ua, 'RKY-AN10')) {
            $device_brand = "荣耀";
            $device_model = "Play 7T";
        } elseif (self::strexists($ua, 'PDAT10')) {
            $device_brand = "OPPO";
            $device_model = "A52";
        } elseif (self::strexists($ua, 'RMX3610')) {
            $device_brand = "真我";
            $device_model = "V20";
        } elseif (self::strexists($ua, 'PGKM10')) {
            $device_brand = "一加";
            $device_model = "Ace";
        } elseif (self::strexists($ua, 'REP-AN00')) {
            $device_brand = "荣耀";
            $device_model = "90";
        } elseif (self::strexists($ua, 'PDNM00')) {
            $device_brand = "OPPO";
            $device_model = "Reno4";
        } elseif (self::strexists($ua, 'vivo Z1i')) {
            $device_brand = "VIVO";
            $device_model = "Z1i";
        } elseif (self::strexists($ua, 'MP1701')) {
            $device_brand = "美图";
            $device_model = "MP1701";
        } elseif (self::strexists($ua, 'Pixel 2')) {
            $device_brand = "Pixel";
            $device_model = "2";
        } elseif (self::strexists($ua, 'PESM10')) {
            $device_brand = "OPPO";
            $device_model = "A36";
        } elseif (self::strexists($ua, '2308CPXD0C')) {
            $device_brand = "小米";
            $device_model = "MIX Fold 3";
        } elseif (self::strexists($ua, 'PDRM00')) {
            $device_brand = "OPPO";
            $device_model = "Reno5Pro";
        } elseif (self::strexists($ua, 'HRY-AL00a')) {
            $device_brand = "荣耀";
            $device_model = "10";
        } elseif (self::strexists($ua, 'LE2120')) {
            $device_brand = "一加";
            $device_model = "9pro";
        } elseif (self::strexists($ua, 'PDKT00')) {
            $device_brand = "OPPO";
            $device_model = "A92s";
        } elseif (self::strexists($ua, 'PDAM10')) {
            $device_brand = "OPPO";
            $device_model = "A52";
        } elseif (self::strexists($ua, 'PGGM10')) {
            $device_brand = "OPPO";
            $device_model = "K10x";
        } elseif (self::strexists($ua, 'TYH631M')) {
            $device_brand = "麦芒";
            $device_model = "20";
        } elseif (self::strexists($ua, 'XT2243-2')) {
            $device_brand = "MOTO";
            $device_model = "X30pro";
        } elseif (self::strexists($ua, 'PEAT00')) {
            $device_brand = "OPPO";
            $device_model = "Reno4 SE";
        } elseif (self::strexists($ua, '21091116UC')) {
            $device_brand = "Redmi";
            $device_model = "Note 11 Pro";
        } elseif (self::strexists($ua, '2312DRA50C')) {
            $device_brand = "Redmi";
            $device_model = "Note13Pro";
        } elseif (self::strexists($ua, 'RMX3663')) {
            $device_brand = "真我";
            $device_model = "10 Pro";
        } elseif (self::strexists($ua, '16th Plus')) {
            $device_brand = "魅族";
            $device_model = "16th Plus";
        } elseif (self::strexists($ua, 'Pixel 5')) {
            $device_brand = "Pixel";
            $device_model = "5";
        } elseif (self::strexists($ua, 'Pixel XL')) {
            $device_brand = "Pixel";
            $device_model = "XL";
        } elseif (self::strexists($ua, 'MT2110')) {
            $device_brand = "一加";
            $device_model = "9RT";
        } elseif (self::strexists($ua, 'ADT-AN00')) {
            $device_brand = "荣耀";
            $device_model = "X40";
        } elseif (self::strexists($ua, 'M2007J3SC')) {
            $device_brand = "Redmi";
            $device_model = "K30S";
        } elseif (self::strexists($ua, 'SHARK KLE-A0')) {
            $device_brand = "黑鲨";
            $device_model = "3s";
        } elseif (self::strexists($ua, 'PDEM10')) {
            $device_brand = "OPPO";
            $device_model = "Find X2";
        } elseif (self::strexists($ua, 'vivo X20A')) {
            $device_brand = "VIVO";
            $device_model = "X20A";
        } elseif (self::strexists($ua, '22041216UC')) {
            $device_brand = "Redmi";
            $device_model = "Note12+";
        } elseif (self::strexists($ua, '22011211C')) {
            $device_brand = "Redmi";
            $device_model = "K50";
        } elseif (self::strexists($ua, '2201123C')) {
            $device_brand = "小米";
            $device_model = "12";
        } elseif (self::strexists($ua, 'vivo NEX')) {
            $device_brand = "VIVO";
            $device_model = "NEX";
        } elseif (self::strexists($ua, '2312DRAABC')) {
            $device_brand = "Redmi";
            $device_model = "Note 13";
        } elseif (self::strexists($ua, 'RMX1931')) {
            $device_brand = "真我";
            $device_model = "X2 Pro";
        } elseif (self::strexists($ua, 'PACT00')) {
            $device_brand = "OPPO";
            $device_model = "R15";
        } elseif (self::strexists($ua, '22101317C')) {
            $device_brand = "Redmi";
            $device_model = "Note 12 Pro";
        } elseif (self::strexists($ua, 'XT2251-1')) {
            $device_brand = "MOTO";
            $device_model = "razr";
        } elseif (self::strexists($ua, 'TNNH-AN00')) {
            $device_brand = "荣耀";
            $device_model = "play4";
        } elseif (self::strexists($ua, 'PDST00')) {
            $device_brand = "OPPO";
            $device_model = "Reno5 Pro";
        } elseif (self::strexists($ua, '21121119SC')) {
            $device_brand = "Redmi";
            $device_model = "Note11E Pro";
        } elseif (self::strexists($ua, 'AGT-AN00')) {
            $device_brand = "荣耀";
            $device_model = "Play7T Pro";
        } elseif (self::strexists($ua, 'HRY-AL00')) {
            $device_brand = "荣耀";
            $device_model = "10";
        } elseif (self::strexists($ua, 'vivo X20')) {
            $device_brand = "VIVO";
            $device_model = "X20";
        } elseif (self::strexists($ua, 'RMX2200')) {
            $device_brand = "真我";
            $device_model = "V3";
        } elseif (self::strexists($ua, 'LGE-AN20')) {
            $device_brand = "荣耀";
            $device_model = "Magic4";
        } elseif (self::strexists($ua, '22031116BG')) {
            $device_brand = "Redmi";
            $device_model = "Note 11S";
        } elseif (self::strexists($ua, 'RMX3615')) {
            $device_brand = "真我";
            $device_model = "10";
        } elseif (self::strexists($ua, 'RMX3551')) {
            $device_brand = "真我";
            $device_model = "GT2";
        } elseif (self::strexists($ua, 'FRI-AN00')) {
            $device_brand = "荣耀";
            $device_model = "Magic Vs";
        } elseif (self::strexists($ua, 'V1831T')) {
            $device_brand = "VIVO";
            $device_model = "Z3i";
        } elseif (self::strexists($ua, 'RMX3461')) {
            $device_brand = "真我";
            $device_model = "Q3s";
        } elseif (self::strexists($ua, 'VER-AN10')) {
            $device_brand = "荣耀";
            $device_model = "Magic V2";
        } elseif (self::strexists($ua, '23046RP50C')) {
            $device_brand = "小米";
            $device_model = "6pro";
        } elseif (self::strexists($ua, 'PBBM30')) {
            $device_brand = "OPPO";
            $device_model = "A5";
        } elseif (self::strexists($ua, 'PGT-AN20')) {
            $device_brand = "荣耀";
            $device_model = "Magic5";
        } elseif (self::strexists($ua, 'VP005')) {
            $device_brand = "华为";
            $device_model = "优畅享30Plus";
        } elseif (self::strexists($ua, 'PHU110')) {
            $device_brand = "OPPO";
            $device_model = "Reno10 Pro";
        } elseif (self::strexists($ua, '22041219C')) {
            $device_brand = "Redmi";
            $device_model = "note11";
        } elseif (self::strexists($ua, 'PCNM00')) {
            $device_brand = "OPPO";
            $device_model = "K5";
        } elseif (self::strexists($ua, 'WDY-AN00')) {
            $device_brand = "荣耀";
            $device_model = "畅玩40";
        } elseif (self::strexists($ua, 'TEL-AN00')) {
            $device_brand = "荣耀";
            $device_model = "X10";
        } elseif (self::strexists($ua, 'M1852')) {
            $device_brand = "魅族";
            $device_model = "X8";
        } elseif (self::strexists($ua, 'PEGT10')) {
            $device_brand = "OPPO";
            $device_model = "Reno5";
        } elseif (self::strexists($ua, 'vivo Y83A')) {
            $device_brand = "VIVO";
            $device_model = "Y83A";
        } elseif (self::strexists($ua, 'PCCT00')) {
            $device_brand = "OPPO";
            $device_model = "Reno";
        } elseif (self::strexists($ua, '22120RN86G')) {
            $device_brand = "Redmi";
            $device_model = "12C";
        } elseif (self::strexists($ua, 'NX729J')) {
            $device_brand = "红魔";
            $device_model = "8Pro";
        } elseif (self::strexists($ua, 'GIA-AN80')) {
            $device_brand = "荣耀";
            $device_model = "80SE";
        } elseif (self::strexists($ua, 'M2006C3LC')) {
            $device_brand = "Redmi";
            $device_model = "9A";
        } elseif (self::strexists($ua, 'XT2171-3')) {
            $device_brand = "MOTO";
            $device_model = "G51";
        } elseif (self::strexists($ua, 'ALH-BD00')) {
            $device_brand = "华为智选";
            $device_model = "nova 10";
        } elseif (self::strexists($ua, 'PGU110')) {
            $device_brand = "OPPO";
            $device_model = "Find N2 Flip";
        } elseif (self::strexists($ua, 'Pixel 4')) {
            $device_brand = "Pixel";
            $device_model = "4";
        } elseif (self::strexists($ua, 'V1924A')) {
            $device_brand = "VIVO";
            $device_model = "V1924A";
        } elseif (self::strexists($ua, 'PHS110')) {
            $device_brand = "OPPO";
            $device_model = "A1";
        } elseif (self::strexists($ua, 'BND-AL00')) {
            $device_brand = "荣耀";
            $device_model = "畅玩7X";
        } elseif (self::strexists($ua, 'TEL-TN00')) {
            $device_brand = "荣耀";
            $device_model = "X10";
        } elseif (self::strexists($ua, 'RMX2173')) {
            $device_brand = "真我";
            $device_model = "Q2Pro";
        } elseif (self::strexists($ua, 'RMX3300')) {
            $device_brand = "真我";
            $device_model = "GT2Pro";
        } elseif (self::strexists($ua, 'KB2000')) {
            $device_brand = "一加";
            $device_model = "8T";
        } elseif (self::strexists($ua, 'MOA-AL00')) {
            $device_brand = "荣耀";
            $device_model = "畅玩9A";
        } elseif (self::strexists($ua, 'XT2071-4')) {
            $device_brand = "MOTO";
            $device_model = "razr";
        } elseif (self::strexists($ua, 'AVA-PA00')) {
            $device_brand = "鼎桥";
            $device_model = "P50";
        } elseif (self::strexists($ua, '22061218C')) {
            $device_brand = "小米";
            $device_model = "MIX FOLD 2";
        } elseif (self::strexists($ua, 'RMX3125')) {
            $device_brand = "真我";
            $device_model = "V11s";
        } elseif (self::strexists($ua, 'PFUM10')) {
            $device_brand = "OPPO";
            $device_model = "A96";
        } elseif (self::strexists($ua, 'PDCM00')) {
            $device_brand = "OPPO";
            $device_model = "Reno3";
        } elseif (self::strexists($ua, 'PEFM00')) {
            $device_brand = "OPPO";
            $device_model = "A35";
        } elseif (self::strexists($ua, 'M2103K19C')) {
            $device_brand = "Redmi";
            $device_model = "Note 10 Pro";
        } elseif (self::strexists($ua, 'RNA-AN00')) {
            $device_brand = "荣耀";
            $device_model = "50Pro";
        } elseif (self::strexists($ua, '23046PNC9C')) {
            $device_brand = "小米";
            $device_model = "Civi 3";
        } elseif (self::strexists($ua, 'Mi A3')) {
            $device_brand = "小米";
            $device_model = "A3";
        } elseif (self::strexists($ua, 'RMX3619')) {
            $device_brand = "真我";
            $device_model = "V30";
        } elseif (self::strexists($ua, 'AQM-AL10')) {
            $device_brand = "荣耀";
            $device_model = "Play4T Pro";
        } elseif (self::strexists($ua, '21051182C')) {
            $device_brand = "小米";
            $device_model = "MIX 4";
        } elseif (self::strexists($ua, 'PHA120')) {
            $device_brand = "OPPO";
            $device_model = "A96";
        } elseif (self::strexists($ua, 'V1813BT')) {
            $device_brand = "VIVO";
            $device_model = "Z3";
        } elseif (self::strexists($ua, 'PEMM00')) {
            $device_brand = "OPPO";
            $device_model = "Reno6 Pro";
        } elseif (self::strexists($ua, '22101316U')) {
            $device_brand = "Redmi";
            $device_model = "Note 12";
        } elseif (self::strexists($ua, '23078RKD5C')) {
            $device_brand = "红米";
            $device_model = "K60Ultra";
        } elseif (self::strexists($ua, 'X16pro')) {
            $device_brand = "荣耀o";
            $device_model = "MagicBook X16 Pro";
        } elseif (self::strexists($ua, 'RMX3687')) {
            $device_brand = "真我";
            $device_model = "10Pro";
        } elseif (self::strexists($ua, 'TFY-AN40')) {
            $device_brand = "荣耀";
            $device_model = "Play6TPro";
        } elseif (self::strexists($ua, 'PEEM00')) {
            $device_brand = "OPPO";
            $device_model = "FindX3Pro";
        } elseif (self::strexists($ua, 'RMX3161')) {
            $device_brand = "真我";
            $device_model = "Q3";
        } elseif (self::strexists($ua, 'vivo NEX A')) {
            $device_brand = "VIVO";
            $device_model = "NEX A";
        } elseif (self::strexists($ua, 'MXW-AN00')) {
            $device_brand = "荣耀";
            $device_model = "30";
        } elseif (self::strexists($ua, 'SHARK PAR-A0')) {
            $device_brand = "黑鲨";
            $device_model = "5";
        } elseif (self::strexists($ua, 'VTL-202201')) {
            $device_brand = "vertu";
            $device_model = "";
        } elseif (self::strexists($ua, 'V2180GA')) {
            $device_brand = "iQOO";
            $device_model = "U5x";
        } elseif (self::strexists($ua, 'Hebe-BD00')) {
            $device_brand = "华为智选";
            $device_model = "Hinova9Pro";
        } elseif (self::strexists($ua, 'vivo X21i A')) {
            $device_brand = "VIVO";
            $device_model = "X21i A";
        } elseif (self::strexists($ua, '22101316UCP')) {
            $device_brand = "Redmi";
            $device_model = "Note12Pro";
        } elseif (self::strexists($ua, 'IN2010')) {
            $device_brand = "一加";
            $device_model = "8Pro";
        } elseif (self::strexists($ua, 'Mi9 Pro')) {
            $device_brand = "小米";
            $device_model = "9 Pro";
        } elseif (self::strexists($ua, 'TFY-AN00')) {
            $device_brand = "荣耀";
            $device_model = "X30i";
        } elseif (self::strexists($ua, 'PHW110')) {
            $device_brand = "OPPO";
            $device_model = "Reno10";
        } elseif (self::strexists($ua, 'PEAM00')) {
            $device_brand = "OPPO";
            $device_model = "Reno4SE";
        } elseif (self::strexists($ua, 'XT2321-2')) {
            $device_brand = "moto";
            $device_model = "razr 40 Ultra";
        } elseif (self::strexists($ua, 'REA-AN00')) {
            $device_brand = "荣耀";
            $device_model = "90";
        } elseif (self::strexists($ua, '2203121C')) {
            $device_brand = "小米12";
            $device_model = "Ultra";
        } elseif (self::strexists($ua, 'PGCM10')) {
            $device_brand = "OPPO";
            $device_model = "K9x";
        } elseif (self::strexists($ua, '2201116SC')) {
            $device_brand = "Redmi";
            $device_model = "Note 11E Pro";
        } elseif (self::strexists($ua, 'PGW110')) {
            $device_brand = "OPPO";
            $device_model = "Reno9 Pro+";
        } elseif (self::strexists($ua, 'PEPM00')) {
            $device_brand = "OPPO";
            $device_model = "Reno6 Pro";
        } elseif (self::strexists($ua, 'PGJM10')) {
            $device_brand = "OPPO";
            $device_model = "K10";
        } elseif (self::strexists($ua, 'PCEM00')) {
            $device_brand = "OPPO";
            $device_model = "A9x";
        } elseif (self::strexists($ua, '22041216C')) {
            $device_brand = "Redmi";
            $device_model = "Note 12";
        } elseif (self::strexists($ua, 'PGAM10')) {
            $device_brand = "OPPO";
            $device_model = "Reno8 Pro";
        } elseif (self::strexists($ua, 'M2004J19C')) {
            $device_brand = "Redmi";
            $device_model = "9";
        } elseif (self::strexists($ua, 'PGT-AN10')) {
            $device_brand = "荣耀";
            $device_model = "Magic5 Pro";
        } elseif (self::strexists($ua, 'RMX3121')) {
            $device_brand = "真我";
            $device_model = "V11";
        } elseif (self::strexists($ua, 'ALI-AN00')) {
            $device_brand = "荣耀";
            $device_model = "X50";
        } elseif (self::strexists($ua, 'PDKM00')) {
            $device_brand = "OPPO";
            $device_model = "A92s";
        } elseif (self::strexists($ua, 'PCKM80')) {
            $device_brand = "OPPO";
            $device_model = "Reno2Z";
        } elseif (self::strexists($ua, 'XT2175-2')) {
            $device_brand = "Moto";
            $device_model = "S30";
        } elseif (self::strexists($ua, 'ELS-N04')) {
            $device_brand = "华为";
            $device_model = "P40Pro";
        } elseif (self::strexists($ua, 'ELZ-AN10')) {
            $device_brand = "荣耀";
            $device_model = "Magic3 Pro";
        } elseif (self::strexists($ua, 'TYH611M')) {
            $device_brand = "华为";
            $device_model = "麦芒10 SE";
        } elseif (self::strexists($ua, '22041219NY')) {
            $device_brand = "Redmi";
            $device_model = "Note 11E";
        } elseif (self::strexists($ua, 'PFDM00')) {
            $device_brand = "OPPO";
            $device_model = "Reno7 Pro";
        } elseif (self::strexists($ua, 'PGFM10')) {
            $device_brand = "OPPO";
            $device_model = "A57";
        } elseif (self::strexists($ua, 'VNE-AN00')) {
            $device_brand = "荣耀";
            $device_model = "畅玩30";
        } elseif (self::strexists($ua, 'PEGT00')) {
            $device_brand = "OPPO";
            $device_model = "Reno5";
        } elseif (self::strexists($ua, 'ALA-AN70')) {
            $device_brand = "荣耀";
            $device_model = "V40";
        } elseif (self::strexists($ua, 'PEYM00')) {
            $device_brand = "OPPO";
            $device_model = "Reno6Pro";
        } elseif (self::strexists($ua, 'YOK-AN10')) {
            $device_brand = "荣耀";
            $device_model = "V40";
        } elseif (self::strexists($ua, 'TDT-MA01')) {
            $device_brand = "华为";
            $device_model = "mate40";
        } elseif (self::strexists($ua, 'NX712J')) {
            $device_brand = "努比亚";
            $device_model = "Z50 Ultra";
        } elseif (self::strexists($ua, 'PDPT00')) {
            $device_brand = "OPPO";
            $device_model = "Reno4";
        } elseif (self::strexists($ua, 'PDBM00')) {
            $device_brand = "OPPO";
            $device_model = "A8";
        } elseif (self::strexists($ua, 'NZA-AL00')) {
            $device_brand = "荣耀";
            $device_model = "Play5T";
        } elseif (self::strexists($ua, 'SP210')) {
            $device_brand = "华为畅享";
            $device_model = "50 Pro";
        } elseif (self::strexists($ua, 'PJA110')) {
            $device_brand = "OPPO";
            $device_model = "A58";
        } elseif (self::strexists($ua, 'Pixel 3')) {
            $device_brand = "Pixel";
            $device_model = "3";
        } elseif (self::strexists($ua, 'RMX3115')) {
            $device_brand = "真我";
            $device_model = "X7Pro";
        } elseif (self::strexists($ua, 'HPB-AN00')) {
            $device_brand = "荣耀";
            $device_model = "70 Pro";
        } elseif (self::strexists($ua, 'SP100')) {
            $device_brand = "荣耀";
            $device_model = "S7";
        } elseif (self::strexists($ua, 'PHB110')) {
            $device_brand = "一加";
            $device_model = "10T";
        } elseif (self::strexists($ua, 'PERM00')) {
            $device_brand = "OPPO";
            $device_model = "K7x";
        } elseif (self::strexists($ua, 'PCLM10')) {
            $device_brand = "OPPO";
            $device_model = "RenoAce";
        } elseif (self::strexists($ua, 'PGEM10')) {
            $device_brand = "OPPO";
            $device_model = "Find X6 Pro";
        } elseif (self::strexists($ua, 'M2006J10C')) {
            $device_brand = "Redmi";
            $device_model = "K30";
        } elseif (self::strexists($ua, 'PEMT00')) {
            $device_brand = "OPPO";
            $device_model = "A55";
        } elseif (self::strexists($ua, 'vivo X21')) {
            $device_brand = "VIVO";
            $device_model = "X21";
        } elseif (self::strexists($ua, '2206123SC')) {
            $device_brand = "小米";
            $device_model = "12S";
        } elseif (self::strexists($ua, 'PEHT00')) {
            $device_brand = "OPPO";
            $device_model = "A95/A53";
        } elseif (self::strexists($ua, 'M2003J15SC')) {
            $device_brand = "红米";
            $device_model = "10X";
        } elseif (self::strexists($ua, 'PFZM10')) {
            $device_brand = "OPPO";
            $device_model = "Reno8Pro+";
        } elseif (self::strexists($ua, 'PCCM00')) {
            $device_brand = "OPPO";
            $device_model = "Reno10";
        } elseif (self::strexists($ua, 'NE2210')) {
            $device_brand = "一加";
            $device_model = "10 Pro";
        } elseif (self::strexists($ua, 'DIO-AN00')) {
            $device_brand = "荣耀";
            $device_model = "X40i";
        } elseif (self::strexists($ua, 'PEXM00')) {
            $device_brand = "OPPO";
            $device_model = "K9";
        } elseif (self::strexists($ua, 'JSN-AL00')) {
            $device_brand = "荣耀";
            $device_model = "8X";
        } elseif (self::strexists($ua, 'PFCM00')) {
            $device_brand = "OPPO";
            $device_model = "R15";
        } elseif (self::strexists($ua, 'PAAM00')) {
            $device_brand = "OPPO";
            $device_model = "R15";
        } elseif (self::strexists($ua, 'PCLM50')) {
            $device_brand = "OPPO";
            $device_model = "Reno3";
        } elseif (self::strexists($ua, 'vivo X9Plus')) {
            $device_brand = "VIVO";
            $device_model = "X9Plus";
        } elseif (self::strexists($ua, 'V2068A')) {
            $device_brand = "VIVO";
            $device_model = "Y31S";
        } elseif (self::strexists($ua, 'TYH601M')) {
            $device_brand = "华为";
            $device_model = "麦芒9";
        } elseif (self::strexists($ua, 'PBCM10')) {
            $device_brand = "OPPO";
            $device_model = "R15x";
        } elseif (self::strexists($ua, 'PHT110')) {
            $device_brand = "OPPO";
            $device_model = "Find N3";
        } elseif (self::strexists($ua, 'SM801')) {

            $device_brand = "锤子";
        } elseif (self::strexists($ua, 'V2154A')) {
            $device_brand = "VIVO";
        } elseif (self::strexists($ua, 'V1962A')) {
            $device_brand = "VIVO";
            $device_model = "S6";
        } elseif (self::strexists($ua, '22095RA98C')) {
            $device_brand = "Redmi";
            $device_model = "Note11R";
        } elseif (self::strexists($ua, 'RMX3122')) {
            $device_brand = "真我";
            $device_model = "V11";
        } elseif (self::strexists($ua, '21091116AC')) {
            $device_brand = "Redmi";
            $device_model = "Note 11";
        } elseif (self::strexists($ua, '2304FPN6DC')) {
            $device_brand = "小米";
            $device_model = "13 Ultra";
        } elseif (self::strexists($ua, 'M2012K10C')) {
            $device_brand = "Redmi";
            $device_model = "K40";
        } elseif (self::strexists($ua, 'HRY-AL00T')) {
            $device_brand = "荣耀";
            $device_model = "10";
        } elseif (self::strexists($ua, '23013RK75C')) {
            $device_brand = "Redmi";
            $device_model = "K60";
        } elseif (self::strexists($ua, 'PGP110')) {
            $device_brand = "一加";
            $device_model = "10T";
        } elseif (self::strexists($ua, 'PERM10')) {
            $device_brand = "OPPO";
            $device_model = "k9s";
        } elseif (self::strexists($ua, 'PADT00')) {
            $device_brand = "OPPO";
            $device_model = "A3";
        } elseif (self::strexists($ua, 'TYH622M')) {
            $device_brand = "华为";
            $device_model = "麦芒11";
        } elseif (self::strexists($ua, 'Mi 10')) {
            $device_brand = "小米";
            $device_model = "10";
        } elseif (self::strexists($ua, 'PBET00')) {
            $device_brand = "OPPO";
            $device_model = "R17";
        } elseif (self::strexists($ua, 'PDYT20')) {
            $device_brand = "OPPO";
            $device_model = "A72";
        } elseif (self::strexists($ua, 'ASUS_I003DD')) {
            $device_brand = "华硕";
            $device_model = "ROG 3";
        } elseif (self::strexists($ua, 'ELZ-AN20')) {
            $device_brand = "荣耀";
            $device_model = "Magic3";
        } elseif (self::strexists($ua, 'LE2110')) {
            $device_brand = "一加";
            $device_model = "9";
        } elseif (self::strexists($ua, '21091116C')) {
            $device_brand = "Redmi";
            $device_model = "Note 11 Pro";
        } elseif (self::strexists($ua, 'M2007J1SC')) {
            $device_brand = "小米";
            $device_model = "10";
        } elseif (self::strexists($ua, 'ARE-AL00')) {
            $device_brand = "荣耀";
            $device_model = "8X Max";
        } elseif (self::strexists($ua, 'PCDM10')) {
            $device_brand = "OPPO";
            $device_model = "Reno Z";
        } elseif (self::strexists($ua, 'RMX2121')) {
            $device_brand = "真我";
            $device_model = "X7 Pro";
        } elseif (self::strexists($ua, 'AKA-AL10')) {
            $device_brand = "荣耀";
            $device_model = "Play4T";
        } elseif (self::strexists($ua, 'ELZ-AN00')) {
            $device_brand = "荣耀";
            $device_model = "Magic3";
        } elseif (self::strexists($ua, 'HLK-AL00')) {
            $device_brand = "荣耀";
            $device_model = "9x";
        } elseif (self::strexists($ua, '2206122SC')) {
            $device_brand = "小米";
            $device_model = "12S";
        } elseif (self::strexists($ua, 'SP300')) {
            $device_brand = "荣耀";
            $device_model = "S7 Pro";
        } elseif (self::strexists($ua, 'HJC-LX9')) {
            $device_brand = "荣耀";
            $device_model = "畅玩20Pro";
        } elseif (self::strexists($ua, 'RMX3350')) {
            $device_brand = "真我";
            $device_model = "GT Neo";
        } elseif (self::strexists($ua, 'GIA-AN00')) {
            $device_brand = "荣耀60";
            $device_model = "SE";
        } elseif (self::strexists($ua, 'M2104K10AC')) {
            $device_brand = "Redmi";
            $device_model = "Note10 Pro";
        } elseif (self::strexists($ua, 'M2007J17C')) {
            $device_brand = "Redmi";
            $device_model = "Note9 Pro";
        } elseif (self::strexists($ua, '22081212C') || self::strexists($ua, '22021211RC') || self::strexists($ua, '22041211AC')) {
            //22021211RC
            $device_brand = "Redmi";
            $device_model = "K50";
        } elseif (self::strexists($ua, 'SAMSUNG') ||  self::strexists($ua, 'SM-')) {
            $device_brand = "三星";
            $device_model = "";
        } elseif (self::strexists($ua, 'CRT-AN00')) {
            $device_brand = "荣耀";
            $device_model = "X50i";
        } elseif (self::strexists($ua, 'FIO-BD00')) {
            $device_brand = "华为智选";
            $device_model = "HiNova9";
        } elseif (self::strexists($ua, 'NTH-AN00')) {
            $device_brand = "荣耀";
            $device_model = "50";
        } elseif (self::strexists($ua, 'RMX3560')) {
            $device_brand = "真我";
            $device_model = "GTNeo3";
        } elseif (self::strexists($ua, 'RMX3751')) {
            $device_brand = "真我";
            $device_model = "11";
        } elseif (self::strexists($ua, 'RMX3310')) {
            $device_brand = "真我";
            $device_model = "GT2Pro";
        } elseif (self::strexists($ua, 'RMX3366')) {
            $device_brand = "真我";
            $device_model = "X9 Pro";
        } elseif (self::strexists($ua, 'RMX3361')) {
            $device_brand = "真我";
            $device_model = "GT大师";
        } elseif (self::strexists($ua, 'RMX2205')) {
            $device_brand = "真我";
            $device_model = "Q3 Pro";
        } elseif (self::strexists($ua, 'RMX2111')) {
            $device_brand = "真我";
            $device_model = "x7";
        } elseif (self::strexists($ua, '2210132C') || self::strexists($ua, '2211133C')) {
            $device_brand = "小米";
            $device_model = "13";
        } elseif (self::strexists($ua, '2201122C')) {
            $device_brand = "小米";
            $device_model = "12Pro";
        } elseif (self::strexists($ua, 'M2102K1AC')) {
            $device_brand = "小米";
            $device_model = "11Pro";
        } elseif (self::strexists($ua, 'M2102J2SC')) {
            $device_brand = "小米";
            $device_model = "10S";
        } elseif (self::strexists($ua, '22122RK93C') || self::strexists($ua, '22101320C') || self::strexists($ua, '22127RK46C')) {
            $device_brand = "小米";
            $device_model = "K60";
        } elseif (self::strexists($ua, '2109119BC')) {
            $device_brand = "小米";
            $device_model = "Civi";
        } elseif (self::strexists($ua, '2209129SC')) {
            $device_brand = "小米";
            $device_model = "Ls9";
        } elseif (self::strexists($ua, '2106118C')) {
            $device_brand = "小米";
            $device_model = "MIX 4";
        } elseif (self::strexists($ua, 'M2011K2C')) {
            $device_brand = "小米";
            $device_model = "11";
        } elseif (self::strexists($ua, 'M2101K9C')) {
            $device_brand = "小米";
            $device_model = "11青春版";
        } elseif (self::strexists($ua, 'M2102K1C')) {
            $device_brand = "小米";
            $device_model = "Ultra";
        } elseif (self::strexists($ua, 'Mi 10 Pro')) {
            $device_brand = "小米";
            $device_model = "10 Pro";
        } elseif (self::strexists($ua, 'M2002J9E')) {
            $device_brand = "小米";
            $device_model = "10青春版";
        } elseif (self::strexists($ua, 'PHQ110')) {
            $device_brand = "OPPO";
            $device_model = "A1Pro";
        } elseif (self::strexists($ua, 'PECT30')) {
            $device_brand = "OPPO";
            $device_model = "A5";
        } elseif (self::strexists($ua, 'PBCM30')) {
            $device_brand = "OPPO";
            $device_model = "k1";
        } elseif (self::strexists($ua, 'PDSM00')) {
            $device_brand = "OPPO";
            $device_model = "Reno5 Pro";
        } elseif (self::strexists($ua, 'PJG110') || self::strexists($ua, 'PGX110')) {
            $device_brand = "OPPO";
            $device_model = "Reno9 Pro";
        } elseif (self::strexists($ua, 'PEDM00')) {
            $device_brand = "OPPO";
            $device_model = "Find X3";
        } elseif (self::strexists($ua, 'PCHM10')) {
            $device_brand = "OPPO";
            $device_model = "A11";
        } elseif (self::strexists($ua, 'PECM30')) {
            $device_brand = "OPPO";
            $device_model = "A53";
        } elseif (self::strexists($ua, 'PBAM00')) {
            $device_brand = "OPPO";
            $device_model = "A5";
        } elseif (self::strexists($ua, 'PBEM00')) {
            $device_brand = "OPPO";
            $device_model = "R17";
        } elseif (self::strexists($ua, 'TEL-AN00a')) {
            $device_brand = "荣耀";
            $device_model = "X10";
        } elseif (self::strexists($ua, 'ARE-AL10')) {
            $device_brand = "荣耀";
            $device_model = "8X Max";
        } elseif (self::strexists($ua, 'KKG-AN00')) {
            $device_brand = "荣耀";
            $device_model = "X10Max";
        } elseif (self::strexists($ua, 'ANG-AN00')) {
            $device_brand = "nova";
            $device_model = "8";
        } elseif (self::strexists($ua, 'JEF-AN20')) {
            $device_brand = "nova";
            $device_model = "7";
        } elseif (self::strexists($ua, 'JER-AN20')) {
            $device_brand = "nova";
            $device_model = "7 Pro";

            //MEIZU
        } elseif (self::strexists($ua, 'MEIZU')) {
            $device_brand = "魅族";
            $device_model = "";
        } elseif (self::strexists($ua, 'RMO-AN00')) {
            $device_brand = "荣耀";
            $device_model = "X40";
        } elseif (self::strexists($ua, 'TEL-AN00a')) {
            $device_brand = "荣耀";
            $device_model = "80";
        } elseif (self::strexists($ua, 'LSA-AN00')) {
            $device_brand = "荣耀";
            $device_model = "60";
        } elseif (self::strexists($ua, 'BMH-AN10')) {
            $device_brand = "荣耀";
            $device_model = "30";
        } elseif (self::strexists($ua, 'TNA-AN00')) {
            $device_brand = "荣耀";
            $device_model = "60 Pro";
        } elseif (self::strexists($ua, 'FNE-AN00')) {
            $device_brand = "荣耀";
            $device_model = "70";
        } elseif (self::strexists($ua, 'ANN-AN00')) {
            $device_brand = "荣耀";
            $device_model = "80";
        } elseif (self::strexists($ua, 'SDY-AN00')) {
            $device_brand = "荣耀";
            $device_model = "70 Pro";
        } elseif (self::strexists($ua, 'HLK-AL10')) {
            $device_brand = "荣耀";
            $device_model = "9XPro";
        } elseif (self::strexists($ua, 'TET-AN10') || self::strexists($ua, 'TEL-AN10')) { //TEL-AN10
            $device_brand = "荣耀";
            $device_model = "X10";
        } elseif (self::strexists($ua, 'ANP-AN00') || self::strexists($ua, 'NTN-AN20')) { //NTN-AN20
            $device_brand = "荣耀";
            $device_model = "X20";
        } elseif (self::strexists($ua, 'CHL-AN00')) {
            $device_brand = "荣耀";
            $device_model = "X20SE";
        } elseif (self::strexists($ua, 'CDY-AN90') || self::strexists($ua, 'CDY-AN95')) {
            $device_brand = "荣耀";
            $device_model = "30s";
        } elseif (self::strexists($ua, 'PCT-AL10')) {
            $device_brand = "荣耀";
            $device_model = "V20";
        } elseif (self::strexists($ua, 'LRA-AL00')) {
            $device_brand = "荣耀";
            $device_model = "20青春版";
        } elseif (self::strexists($ua, 'DUK-AL20')) {
            $device_brand = "荣耀";
            $device_model = "V9";
        } elseif (self::strexists($ua, 'HJC-AN90')) {
            $device_brand = "荣耀";
            $device_model = "play5";
        } elseif (self::strexists($ua, 'KOZ-AL40')) {
            $device_brand = "荣耀";
            $device_model = "play5T";
        } elseif (self::strexists($ua, 'JLH-AN00')) {
            $device_brand = "荣耀";
            $device_model = "50SE";
        } elseif (self::strexists($ua, 'LGE-AN00')) {
            $device_brand = "荣耀";
            $device_model = "Magic4";
        } elseif (self::strexists($ua, 'PGT-AN00')) {
            $device_brand = "荣耀";
            $device_model = "Magic5";
        } elseif (self::strexists($ua, 'LGE-AN10')) {
            $device_brand = "荣耀";
            $device_model = "Magic4 Pro";
        } elseif (self::strexists($ua, 'KKG-AN70')) {
            $device_brand = "荣耀";
            $device_model = "X30 Max";
        } elseif (self::strexists($ua, 'CMA-AN00')) {
            $device_brand = "荣耀畅玩";
            $device_model = "30 Plus";
        } elseif (self::strexists($ua, 'BND-AL10')) {
            $device_brand = "荣耀畅玩";
            $device_model = "7X";
        } elseif (self::strexists($ua, 'LND-AL40')) {
            $device_brand = "荣耀畅玩";
            $device_model = "7c";
        } elseif (self::strexists($ua, 'BLN-TL10')) {

            $device_brand = "荣耀畅玩";
            $device_model = "6X";
        } elseif (self::strexists($ua, 'KOZ-AL00')) {
            $device_brand = "荣耀畅玩";
            $device_model = "20";

            //BND-AL10
        } elseif (self::strexists($ua, 'FRL-AN00a')) {
            $device_brand = "荣耀畅享";
            $device_model = "20 Plus";
        } elseif (self::strexists($ua, 'FIG-AL10')) {
            $device_brand = "华为畅享";
            $device_model = "7s";
        } elseif (self::strexists($ua, 'V2049A')) {
            $device_brand = "iQOO";
            $device_model = "7";
        } elseif (self::strexists($ua, 'V1824A')) {
            $device_brand = "iQOO";
            $device_model = "";
        } elseif (self::strexists($ua, 'V2196A')) {
            $device_brand = "iQOO";
            $device_model = "Neo6";
        } elseif (self::strexists($ua, 'V2131A')) {
            $device_brand = "IQOO";
            $device_model = "Z5x";
        } elseif (self::strexists($ua, 'V2143A')) {
            $device_brand = "iQOO";
            $device_model = "U3x";
            return 'iQOO U3x';
        } elseif (self::strexists($ua, 'V2046A')) {
            $device_brand = "VIVO";
            $device_model = "X60";
        } elseif (self::strexists($ua, 'V2055A')) {
            $device_brand = "iQOO";
            $device_model = "Neo5";
        } elseif (self::strexists($ua, 'V2072A')) {
            $device_brand = "VIVO";
            $device_model = "S9";
        } elseif (self::strexists($ua, 'V2020A')) {
            $device_brand = "VIVO";
            $device_model = "S7";
        } elseif (self::strexists($ua, 'V2121A')) {
            $device_brand = "VIVO";
            $device_model = "S10";
        } elseif (self::strexists($ua, 'V1965A')) {
            $device_brand = "VIVO";
            $device_model = "Y50";
        } elseif (self::strexists($ua, 'V2036A')) {
            $device_brand = "VIVO";
            $device_model = "Y30";
        } elseif (self::strexists($ua, 'V1829A')) {
            $device_brand = "VIVO";
            $device_model = "X27";
        } elseif (self::strexists($ua, 'V1938CT')) {
            $device_brand = "VIVO";
            $device_model = "X30";
        } elseif (self::strexists($ua, 'V2133A')) {
            $device_brand = "VIVO";
            $device_model = "X70";
        } elseif (self::strexists($ua, 'V2241A')) {
            $device_brand = "VIVO";
            $device_model = "X90";
        } elseif (self::strexists($ua, 'V2034A')) {
            $device_brand = "VIVO";
            $device_model = "Y30s";
        } elseif (self::strexists($ua, 'V2057A')) {
            $device_brand = "VIVO";
            $device_model = "Y2s";
        } elseif (self::strexists($ua, 'V1818CA')) {
            $device_brand = "VIVO";
            $device_model = "Y93s";
        } elseif (self::strexists($ua, 'V2164A')) {
            $device_brand = "VIVO";
            $device_model = "Y55s";
        } elseif (self::strexists($ua, 'V1923A')) {
            $device_brand = "VIVO";
            $device_model = "Y7s";
        } elseif (self::strexists($ua, 'V2156A')) {
            $device_brand = "VIVO";
            $device_model = "Y55s";
        } elseif (self::strexists($ua, 'V2166BA')) {
            $device_brand = "VIVO";
            $device_model = "Y77e";
        } elseif (self::strexists($ua, 'V2002A')) {
            $device_brand = "VIVO";
            $device_model = "Y70s";
        } elseif (self::strexists($ua, 'V2166A')) {
            $device_brand = "VIVO";
            $device_model = "Y33s";
        } elseif (self::strexists($ua, 'V2170A')) {
            $device_brand = "VIVO";
            $device_model = "X Note";
        } elseif (self::strexists($ua, 'V2239A') || self::strexists($ua, 'V1981A') ||  self::strexists($ua, 'V2203A') ||  self::strexists($ua, 'V2001A') ||  self::strexists($ua, 'V1938T')) {

            $device_brand = "VIVO";
            $device_model = "";
            //V2170A
        } elseif (self::strexists($ua, '; V') && self::strexists($ua, 'A Build')) {
            $device_brand = "VIVO";
            $device_model = "";
        } elseif (self::strexists($ua, 'PHK110') || self::strexists($ua, 'PHP110')) {

            $device_brand = "一加";
            $device_model = "";
        } elseif (self::strexists($ua, 'PFTM20') || self::strexists($ua, 'PHJ110') || self::strexists($ua, 'PCAM00') || self::strexists($ua, 'PCAT00') || self::strexists($ua, 'PEMM20') || self::strexists($ua, 'PFFM10')) {
            $device_brand = "OPPO";
            $device_model = "";

            //|| self::strexists($ua, 'PHP110')
        } elseif (self::strexists($ua, 'PGBM10')) {
            $device_brand = "OPPO";
            $device_model = "Reno8";
        } elseif (self::strexists($ua, 'PEGM00')) {
            $device_brand = "OPPO";
            $device_model = "Reno5";
        } elseif (self::strexists($ua, 'PDNT00')) {
            $device_brand = "OPPO";
            $device_model = "Reno4";
        } elseif (self::strexists($ua, 'PDVM00')) {

            $device_brand = "OPPO";
            $device_model = "A32";
        } elseif (self::strexists($ua, 'PFVM10')) {

            $device_brand = "OPPO";
            $device_model = "A56";
        } elseif (self::strexists($ua, 'PHV110')) {

            $device_brand = "OPPO";
            $device_model = "Reno10 Pro";
        } elseif (self::strexists($ua, 'PEGM10')) {

            $device_brand = "OPPO";
            $device_model = "Reno5 k";
        } elseif (self::strexists($ua, 'PFTM10')) {
            $device_brand = "OPPO";
            $device_model = "A97";
        } elseif (self::strexists($ua, 'PDYM20')) {
            $device_brand = "OPPO";
            $device_model = "A72";
        } elseif (self::strexists($ua, 'PCAM10')) {

            $device_brand = "OPPO";
            $device_model = "A9";
        } elseif (self::strexists($ua, 'PFGM00')) {

            $device_brand = "OPPO";
            $device_model = "A93";
        } elseif (self::strexists($ua, 'PCPM00')) {

            $device_brand = "OPPO";
            $device_model = "A91";
        } elseif (self::strexists($ua, 'PCHM30')) {

            $device_brand = "OPPO";
            $device_model = "A11x";
        } elseif (self::strexists($ua, 'PEUM00')) {

            $device_brand = "OPPO";
            $device_model = "FindN";
        } elseif (self::strexists($ua, 'PEQM00')) {

            $device_brand = "OPPO";
            $device_model = "FindX";
        } elseif (self::strexists($ua, 'PGT110')) {

            $device_brand = "OPPO";
            $device_model = "FindN2";
        } elseif (self::strexists($ua, 'PHM110')) {

            $device_brand = "OPPO";
            $device_model = "Reno9";
        } elseif (self::strexists($ua, 'NAM-AL00')) {

            $device_brand = "OPPO";
            $device_model = "nova9";
        } elseif (self::strexists($ua, 'PDHM00')) {

            $device_brand = "OPPO";
            $device_model = "Reno Ace 2";
        } elseif (self::strexists($ua, 'PELM00')) {

            $device_brand = "OPPO";
            $device_model = "Reno5 Lite";
        } elseif (self::strexists($ua, 'PCRM00')) {

            $device_brand = "OPPO";
            $device_model = "Reno3 Pro";
        } elseif (self::strexists($ua, 'SEA-AL10')) {

            $device_brand = "OPPO";
            $device_model = "Reno5 Pro";
        } elseif (self::strexists($ua, 'PEHM00')) {

            $device_brand = "OPPO";
            $device_model = "Reno6 Pro";
        } elseif (self::strexists($ua, 'PFJM10')) {

            $device_brand = "OPPO";
            $device_model = "Reno7";
        } elseif (self::strexists($ua, 'PDPM00')) {

            $device_brand = "OPPO";
            $device_model = "Reno4";
        } elseif (self::strexists($ua, 'PCKM00')) {

            $device_brand = "OPPO";
            $device_model = "Reno2";
        } elseif (self::strexists($ua, 'LIO-AN00') || self::strexists($ua, 'LIO-AL00')) {

            $device_brand = "华为";
            $device_model = "Mate 30 Pro";
        } elseif (self::strexists($ua, 'TAS-AL00') || self::strexists($ua, 'TAS-AN00')) {

            $device_brand = "华为";
            $device_model = "Mate 30";
        } elseif (self::strexists($ua, 'OCE-AN10')) {

            $device_brand = "华为";
            $device_model = "Mate 40";
        } elseif (self::strexists($ua, 'CET-AL00')) {

            $device_brand = "华为";
            $device_model = "Mate 50";
        } elseif (self::strexists($ua, 'ALE-CL00')) {

            $device_brand = "华为";
            $device_model = "P8";
        } elseif (self::strexists($ua, 'HMA-AL00')) {

            $device_brand = "华为";
            $device_model = "Mate 20";
        } elseif (self::strexists($ua, 'MHA-AL00')) {

            $device_brand = "华为";
            $device_model = "Mate 9";
        } elseif (self::strexists($ua, 'LYA-AL00')) {

            $device_brand = "华为";
            $device_model = "Mate 20 Pro";
        } elseif (self::strexists($ua, 'TET-AN50')) {

            $device_brand = "华为";
            $device_model = "Mate X2";
        } elseif (self::strexists($ua, 'PAL-AL00') || self::strexists($ua, 'TET-AN00')) { //TET-AN00

            $device_brand = "华为";
            $device_model = "Mate Xs2";
        } elseif (self::strexists($ua, 'ALT-AL00')) {

            $device_brand = "华为";
            $device_model = "Mate X3";
        } elseif (self::strexists($ua, 'DCO-AL00')) {

            $device_brand = "华为";
            $device_model = "Mate 50 Pro";
        } elseif (self::strexists($ua, 'BLA-AL00')) {

            $device_brand = "华为";
            $device_model = "Mate 10 Pro";
        } elseif (self::strexists($ua, 'ELS-AN00')) {

            $device_brand = "华为";
            $device_model = "Mate P40 Pro";
        } elseif (self::strexists($ua, 'OCE-AN50')) {

            $device_brand = "华为";
            $device_model = "Mate 40E";
        } elseif (self::strexists($ua, 'NOH-AN01') || self::strexists($ua, 'NOH-AN00')) {

            $device_brand = "华为";
            $device_model = "Mate 40 Pro";
            //NOH-AN01
        } elseif (self::strexists($ua, 'MNA-AL00') || self::strexists($ua, 'LNA-AL00')) {

            $device_brand = "华为";
            $device_model = "P60";
        } elseif (self::strexists($ua, 'ANA-AN00')) {

            $device_brand = "华为";
            $device_model = "P40";
        } elseif (self::strexists($ua, 'EML-AL00')) {

            $device_brand = "华为";
            $device_model = "P20";
        } elseif (self::strexists($ua, 'ELS-AN10')) {

            $device_brand = "华为";
            $device_model = "P40 Pro";
        } elseif (self::strexists($ua, 'ELE-AL00')) {

            $device_brand = "华为";
            $device_model = "P30";
        } elseif (self::strexists($ua, 'CLT-AL00')) {

            $device_brand = "华为";
            $device_model = "P20 Pro";
        } elseif (self::strexists($ua, 'VOG-AL10')) {

            $device_brand = "华为";
            $device_model = "P30 Pro";
        } elseif (self::strexists($ua, 'VOG-AL00')) {

            $device_brand = "华为";
            $device_model = "Mate P30 Pro";
        } elseif (self::strexists($ua, 'ANY-AN00')) {
            return '华为nova 8';
            $device_brand = "华为";
            $device_model = "P30";
        } elseif (self::strexists($ua, 'SPN-AL00')) {

            $device_brand = "华为";
            $device_model = "nova 5i Pro";
        } elseif (self::strexists($ua, 'GLK-AL00')) {

            $device_brand = "华为";
            $device_model = "nova 5i";
        } elseif (self::strexists($ua, 'VCE-AL00')) {

            $device_brand = "华为";
            $device_model = "nova 4";
        } elseif (self::strexists($ua, 'WLZ-AN00')) {

            $device_brand = "华为";
            $device_model = "nova 6";
        } elseif (self::strexists($ua, 'JEF-AN00') || self::strexists($ua, 'JEF-TN00')) { //JEF-TN00

            $device_brand = "华为";
            $device_model = "nova 7";
        } elseif (self::strexists($ua, 'CND-AN00')) {

            $device_brand = "华为";
            $device_model = "nova 7SE";
        } elseif (self::strexists($ua, 'JSC-AL50')) {

            $device_brand = "华为";
            $device_model = "nova 8SE";
        } elseif (self::strexists($ua, 'FOA-AL00')) {

            $device_brand = "华为";
            $device_model = "nova 11";
        } elseif (self::strexists($ua, 'JAD-AL50') || self::strexists($ua, 'ABR-AL80')) {

            $device_brand = "华为";
            $device_model = "P50";
        } elseif (self::strexists($ua, 'TYH612M')) {

            $device_brand = "华为";
            $device_model = "麦芒10";
        } elseif (self::strexists($ua, 'JAD-AL00')) {
            //TYH612M
            $device_brand = "华为";
            $device_model = "P50 Pro";
        } elseif (self::strexists($ua, 'SP200')) {

            $device_brand = "NZONE";
            $device_model = "S7 Pro";
        } elseif (self::strexists($ua, 'ABR-AL60')) {

            $device_brand = "华为";
            $device_model = "P50E";
        } elseif (self::strexists($ua, 'BAL-AL00')) {

            $device_brand = "华为";
            $device_model = "P50 Pocket";
        } elseif (self::strexists($ua, 'Hera-BD00')) {

            $device_brand = "华为";
            $device_model = "Hi nova9";
        } elseif (self::strexists($ua, 'VP002')) {

            $device_brand = "华为";
            $device_model = "优畅享20";
        } elseif (self::strexists($ua, 'VP003')) {

            $device_brand = "华为";
            $device_model = "优畅享30E";
        } elseif (self::strexists($ua, 'HarmonyOS')) {
            $device_brand = "华为鸿蒙";
            $device_model = "鸿蒙";
            $os_type = "鸿蒙";
        } elseif (self::strexists($ua, 'VP001')) {

            $device_brand = "华为";
            $device_model = "畅享20plus";
        } elseif (self::strexists($ua, 'RKY-AN00') || self::strexists($ua, 'NOH-AN01')) {

            $device_brand = "华为";
            $device_model = "Mate 40 Pro";
        } elseif (self::strexists($ua, 'MI')) {

            $device_brand = "小米";
            $device_model = "";
        } elseif (self::strexists($ua, 'M2012K11C')) {
            $device_brand = "Redmi";
            $device_model = "K40 Pro";
        } elseif (self::strexists($ua, '2201116SG')) {
            $device_brand = "Redmi";
            $device_model = "Note11S";
        } elseif (self::strexists($ua, 'M2012K11AC')) {
            $device_brand = "Redmi";
            $device_model = "K40";
        } elseif (self::strexists($ua, '23049RAD8C')) {
            $device_brand = "Redmi";
            $device_model = "Note 12 Turbo";
        } elseif (self::strexists($ua, 'Redmi') || self::strexists($ua, '22101316C') || self::strexists($ua, 'M2007J22C')) {

            $device_brand = "Redmi";
            $device_model = "";
        } elseif (self::strexists($ua, 'HUAWEI')) {
            $device_brand = "华为";
            $device_model = "";
        } elseif (self::strexists($ua, 'Huawei')) {
            $device_brand = "华为";
            $device_model = "";
        } elseif (self::strexists($ua, 'HMSCore')) {
            $device_brand = "华为";
            $device_model = "";
        } elseif (self::strexists($ua, 'OPPO')) {
            $device_brand = "OPPO";
            $device_model = "";
        } elseif (self::strexists($ua, 'FreeBSD')) {
            $device_brand = "FreeBSD";
            $device_model = "";
        } elseif (self::strexists($ua, 'ONEPLUS')) {
            $device_brand = "一加";
            $device_model = "";
        } elseif (self::strexists($ua, 'Solaris')) {
            $device_brand = "Solaris";
            $device_model = "";
        } elseif (self::strexists($ua, 'Android')) {
            $device_brand = "";
            $device_model = "";
        }
        $data['device_brand'] = $device_brand;
        $data['device_model'] = $device_model;
        $data['os_type'] = $os_type;
        //Mozilla/5.0 (iPhone; CPU iPhone OS 15_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.42(0x18002a2f) NetType/4G Language/zh_CN
        $ver = self::getOsVer($ua);
        $data['net_type'] = self::getNetType($ua);
        $data['os_ver'] = $ver;
        //Mozilla/5.0 (Linux; Android 13; M2102J2SC Build/TKQ1.220829.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/111.0.5563.116 Mobile Safari/537.36 XWEB/5307 MMWEBSDK/20230805 MMWEBID/9356 MicroMessenger/8.0.42.2460(0x28002AD3) WeChat/arm64 Weixin NetType/5G Language/zh_CN ABI/arm64|a/5.0(Linux;Android13;M2102J2SC
        if (self::strexists($ua, 'Android')) {
            if (self::strexists($ua, 'zh-cn;')) {
                $model = self::getSubstr($ua, 'zh-cn; ', ' Build');
            } elseif (self::strexists($ua, 'zh-CN;')) {
                $model = self::getSubstr($ua, 'zh-CN; ', ' Build');
            } else {
                if (self::strexists($ua, $ver . '; ') && self::strexists($ua, 'Build')) {
                    $model = self::getSubstr($ua, $ver . '; ', ' Build');
                } else {
                    // return $model;
                    if (!$model) {
                        $model = self::getSubstr($ua, $ver . '; ', ')');
                    }
                }
            }
            //Mozilla/5.0 (Linux; Android 9; SCV45) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.5563.58 Mobile Safari/537.36
        }
        //echo $model;
        //exit;
        if (strlen($model) > 18) {
        } else {
            if ($model && $device_brand) {
                $m = db::table('fa_ua_model')->where('model', $model)->find();
                if (!$m) {
                    db::table('fa_ua_model')->insert(['model' => $model, 'phone_type' => $device_brand, 'phone_model' => $device_model]);
                }
            } elseif ($model && !$device_brand) {
                $m = db::table('fa_ua_weishibie')->where('model', $model)->find();
                if (!$m) {
                    db::table('fa_ua_weishibie')->insert(['model' => $model]);
                }
            }
        }

        return $data;
        //Mozilla/5.0 (Linux; U; Android 11; zh-cn; PCAM10 Build/RP1A.200720.011) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/90.0.4430.61 Mobile Safari/537.36 HeyTapBrowser/40.8.14.1
    }
    /**
     * 获取网络类型
     */
    public static function getNetType($ua)
    {
        if (self::strexists($ua, 'NetType/4G')) {
            return "4G";
        } elseif (self::strexists($ua, 'NetType/5G')) {
            return "5G";
        } elseif (self::strexists($ua, 'NetType/WIFI')) {
            return "WIFI";
        }
        return "";
    }
    /**
     * 钉钉通知
     * @param string 内容
     */
    public static function dingding($content, $token = "3acdcd1692e6ca3fee6bf21ba73c6a837e1ff69b95d63a4be3c7bd3df25886b6")
    {
        $webhook = "https://oapi.dingtalk.com/robot/send?access_token=" . $token;
        $data = array('msgtype' => 'text', 'text' => array('content' => $content));
        $data_string = json_encode($data);
        //return $data_string ;
        $rst = self::curl_json($webhook, $data_string);
        return $rst;
    }
    /**
     * 发送json请求 post
     */
    public static function curl_json($remote_server, $post_string)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $remote_server);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json;charset=utf-8'));
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        // 线下环境不用开启curl证书验证, 未调通情况可尝试添加该代码
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        $data = curl_exec($ch);
        curl_close($ch);
        return $data;
    }
    /**
     * 获取系统版本
     */
    public static function getOsVer($ua)
    {
        if (self::strexists($ua, 'Android')) {
            if (self::strexists($ua, 'Android 13')) {
                return self::getSubstr($ua, 'Android ', ';');
                return "13";
            } elseif (self::strexists($ua, 'Android 12')) {
                return self::getSubstr($ua, 'Android ', ';');
                return "12";
            } elseif (self::strexists($ua, 'Android 11')) {
                return self::getSubstr($ua, 'Android ', ';');
                return "11";
            } elseif (self::strexists($ua, 'Android 10')) {
                return self::getSubstr($ua, 'Android ', ';');
                return "10";
            } elseif (self::strexists($ua, 'Android 9')) {
                return self::getSubstr($ua, 'Android ', ';');
                return "9";
            } elseif (self::strexists($ua, 'Android 8')) {
                return self::getSubstr($ua, 'Android ', ';');
                return "8";
            } elseif (self::strexists($ua, 'Android 7')) {
                return self::getSubstr($ua, 'Android ', ';');
                return "7";
            } elseif (self::strexists($ua, 'Android 6')) {
                return self::getSubstr($ua, 'Android ', ';');
                return "6";
            } elseif (self::strexists($ua, 'Android 5')) {
                return self::getSubstr($ua, 'Android ', ';');
                return "6";
            }
        } elseif (self::strexists($ua, 'iPhone;')) {
            //OS 15_4_1 like
            return str_replace(' ', '', self::getSubstr($ua, 'OS', 'like'));
        }

        return "";
    }
    /**
     * 获取浏览器类型
     */
    public static function getBrotype($ua)
    {
        if (self::strexists($ua, 'Edge')) {
            return 'Edge';
        } elseif (self::strexists($ua, 'Firefox')) {
            return 'Firefox';
        } elseif (self::strexists($ua, 'Alipay')) {
            return 'Alipay';
        } elseif (self::strexists($ua, '360')) {
            return '360';
        } elseif (self::strexists($ua, 'Opera')) {
            return 'Opera';
        } elseif (self::strexists($ua, 'Sogou')) {
            return '搜狗浏览器';
        } elseif (self::strexists($ua, 'TencentTraveler')) {
            return '腾讯浏览器';
        } elseif (self::strexists($ua, 'UC')) {
            return 'UC浏览器';
        } elseif (self::strexists($ua, 'MicroMessenger')) {
            return 'WeChat';
        } elseif (self::strexists($ua, 'TIM')) {
            return 'TIM';
        } elseif (self::strexists($ua, 'Maxthon')) {
            return '遨游浏览器';
        } elseif (self::strexists($ua, 'Quark')) {
            return '夸克浏览器';
        } elseif (self::strexists($ua, 'Baidu')) {
            return '百度浏览器';
        } elseif (self::strexists($ua, '2345')) {
            return '2345浏览器';
        } elseif (self::strexists($ua, 'LieBao')) {
            return '猎豹浏览器';
        } elseif (self::strexists($ua, 'Vivo')) {
            return 'vivo浏览器';
        }


        return "浏览器";
    }
    /**
     * 寻找文本 存在返回真 不存在返回假
     * 全部文本
     * 要找的文本
     */

    public static function strexists($string, $find)
    {
        if (!$find || !$string) {
            return false;
        }
        return !(strpos($string, $find) === false);
    }
    /**
     * 取中间文本
     * @param unknown $str
     * @param number $leftStr
     * @param number $rightStr
     */
    public static function getSubstr($str1, $leftStr1, $rightStr1)
    {

        $left = strpos($str1, $leftStr1);
        $right = strpos($str1, $rightStr1, $left);
        if ($left < 0 or $right < $left) {
            return '';
        }

        return substr($str1, $left + strlen($leftStr1), $right - $left - strlen($leftStr1));
    }
}
